package com.syqc.custom

import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.viewpager.widget.ViewPager
import kotlin.math.abs

/**
 *@Author Jasper
 *@Time   2021/3/1
 *@Desc   todo
 */
class ScrollViewPager : ViewPager {
    constructor(context: Context) : super(context)

    constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)

    override fun canScroll(v: View?, checkV: Boolean, dx: Int, x: Int, y: Int): Boolean {
        return if (abs(dx) > 50) {
            super.canScroll(v, checkV, dx, x, y)
        } else {
            true
        }
    }
}